package com.hadwinling.blog.mapper;

import com.hadwinling.blog.entity.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

/**
 * @author HadwinLing
 * @version V1.0
 * @Package com.hadwinling.blog.mapper
 * @date 2020/9/13 15:02
 */
@Mapper
public interface MessageMapper {
    /**
     * delete by primary key
     *
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(Message record);

    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(Message record);

    /**
     * select by primary key
     *
     * @param id primary key
     * @return object by primary key
     */
    Message selectByPrimaryKey(Integer id);

    /**
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(Message record);

    /**
     * update record
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(Message record);

    List<Message> selectAllByAdminidAndState(@Param("adminid") Integer adminid, @Param("state") Integer state);

    List<Message> selectAllByAdminidAndStateAndIsread(@Param("adminid") Integer adminid, @Param("state") Integer state, @Param("isread") Integer isread);

    Integer countByAdminidAndIsreadAndState(@Param("adminid") Integer adminid, @Param("isread") Integer isread, @Param("state") Integer state);

    List<Message> selectAllByAdminidAndIsreadAndStateOrderByCreatetimeDesc(@Param("adminid")Integer adminid,@Param("isread")Integer isread,@Param("state")Integer state);



}